folly/cli: eliminate double scan in cli_parse_args_from_content EOF path - #2647
Closed
darion-yaphet wants to merge 184 commits into
Closed
folly/cli: eliminate double scan in cli_parse_args_from_content EOF path#2647darion-yaphet wants to merge 184 commits into
darion-yaphet wants to merge 184 commits into
Conversation
The code that handles a token still in `current` when content ends had
two independent backward scans:
1. A `while/pop_back` loop that stripped trailing spaces from the
processed string value (`current`).
2. A `for` loop that scanned `content` backward from EOF to recompute
the byte-span `length`, because `current` may have undergone escape
substitution and its size no longer matches the raw source bytes.
The root cause was that the main scan loop had no record of *where* in
`content` the last non-whitespace character of the current token sat.
Fix: add `token_end_offset` (byte index into `content` of the last
non-space character), updated in every branch that already updates
`token_end_line`/`token_end_col` — seven sites in total. The EOF path
can now compute `length = token_end_offset + 1 - token_start` in O(1),
removing the backward scan of `content` entirely. The `while/pop_back`
trim of `current` is kept (it handles the string value) but tightened
to the idiomatic `while (!x.empty() && cond(x.back()))` form.
…own.py Differential Revision: D102456661 fbshipit-source-id: 11f7de1c7fdbbdc698a7f5ff6bd55113963cd4b0
…own.py Differential Revision: D102504637 fbshipit-source-id: b6420a4914d85a449d556649511ad74235d4dea9
Summary: Replace tmpfile() with mkstemp() + unlink() in File::temporary() on POSIX platforms. Android bionic's tmpfile() hardcodes /data/local/tmp and ignores $TMPDIR, causing EACCES failures inside instrumentation test APKs where the process lacks write access to that directory. Use fs::temp_directory_path() to resolve the temp directory ($TMPDIR-aware) and mkstemp for atomic file creation, then unlink immediately to preserve the existing anonymous-file semantics. On Windows, use tmpfile_s() for better error reporting. Reviewed By: Orvid Differential Revision: D102013292 fbshipit-source-id: 847490711c006d5da2c20db928329d0f18112cfc
Summary: Use fb_xplat_cxx_test for xplat/folly/test:file_test so the target can build and run under the Android instrumentation path, same pattern as memory_mapping_test. All nine tests run on both Linux and Android — the preceding diff ensures fs::temp_directory_path() works correctly on Android by reading $TMPDIR which the XplatTestRunner sets to the app cache directory. ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: ca_on_device_oncall landed-with-radar-review Differential Revision: D102013291 fbshipit-source-id: 6bea0c85168e5507fb029d9244261fcfa44be323
Summary: Use fb_xplat_cxx_test for xplat/folly/system/test:memory_mapping_test so the target can build and run under the Android instrumentation path. This is a targeted workaround until folly_xplat_cxx_test forwards Android test attrs correctly for xplat/folly more generally. Differential Revision: D100039097 fbshipit-source-id: 8810c362ddeb003734895234a817f7baf218e28b
…r workflow Summary: Effectively bumps XCode to 16.2 - which has better support for modern C++. macOS GitHub Actions runners with multiple Xcode versions installed need DEVELOPER_DIR set to select the correct toolchain. Without it, CMake may find the wrong compiler or SDK and the build can fail. Add DEVELOPER_DIR: /Applications/Xcode_16.2.app/Contents/Developer to the env block emitted for darwin builds in the getdeps.py generate-github-actions command, and regenerate the rebalancer oss_root/.github/workflows/getdeps_mac.yml to match. Reviewed By: xiatingouyang Differential Revision: D102531661 fbshipit-source-id: 62ac61a44989414e59df5d7a50a166548c354287
…n Windows Summary: folly/portability/PThread.cpp uses boost::detail::set_tss_data and get_tss_data on Windows, so Boost::thread must be a transitive dependency of Folly::folly. The existing direct `target_link_libraries` call in the `if(WIN32)` block correctly links Boost::thread into folly_portability_pthread, but does not propagate through the monolithic Folly::folly target because that target assembles its external deps from the FOLLY_MONOLITHIC_EXTERNAL_DEPS global property, which is only populated via the EXTERNAL_DEPS mechanism of `folly_add_library`. Adding Boost::thread to that property on Windows ensures consumers of Folly::folly get it transitively without having to link it explicitly themselves. Reviewed By: xiatingouyang Differential Revision: D102531966 fbshipit-source-id: 784d576986d124543ccf08c5582180181248e4eb
Summary: ### THIS DIFF Teach `folly::MemoryMapping` to size Android ashmem-backed file descriptors transparently by probing `ASharedMemory_getSize(fd)` before falling back to `fstat()`, and add coverage for that path. ### PLAN 1. Add legacy regular-file coverage. 2. Teach `folly::MemoryMapping` to size Android shared-memory fds transparently. 3. Migrate Codec Avatar back to `folly::MemoryMapping` and delete `SharedMemoryMapping`. ### CONTEXT Codec Avatar currently needs a custom Android-only mapping path because ashmem-backed render asset fds report an unusable size through the existing Folly path. This diff fixes that gap in Folly without adding a new caller-visible API and preserves the existing regular-file behavior when the ashmem probe does not apply. Differential Revision: D99928672 fbshipit-source-id: a86432e7c380983a053bdd1430bde2686960c651
Summary: GitHub commits: WhatsApp/eqwalizer@9330bf7 facebook/fb303@bb6e3a4 facebook/fbthrift@5f79e50 facebook@17ddd73 facebook/mvfst@b2c529f facebook/proxygen@a91e395 facebook/pyrefly@f137c67 facebook/wangle@44499bf facebookexperimental/edencommon@0b51148 facebookexperimental/rust-shed@c3bb94d facebookincubator/fizz@195ff56 Reviewed By: pranavcivi fbshipit-source-id: 243852aaa47ce88fa1b9eaf5edc2aa604ac88a8e
Summary: Add xxhash to OSS since ShmManager now depends on it Reviewed By: pbhandar2 Differential Revision: D99326496 fbshipit-source-id: c57d1dfd7f9e142959a093e30ae605185b1f360a
…late in folly/python/test Differential Revision: D102567513 fbshipit-source-id: b23eebb8baa58187cb3eb1c96df69a348c4692f9
Summary: Fix forward for T267364388, opt out memory_mapping_test from individual AIT ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: rl_ci Differential Revision: D102624165 fbshipit-source-id: d17bb556a0248085efc2f410f935c6caca76c8ac
Summary: Remove dead doc link in Range.h ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: sequence_storage_client landed-with-radar-review Differential Revision: D102189379 fbshipit-source-id: 76b8f94d68642b87800c8567837ec8c763052fc6
Reviewed By: marksantaniello Differential Revision: D102315649 fbshipit-source-id: 9245ea1666cb5b82c58b35b5957cd7c4b649ff6c
Summary: The JSON5 parser was incorrectly preserving "\n" in LineContinuation sequences (backslash + newline). Per the JSON5 spec and ECMAScript 5.1, a LineContinuation should discard "\n": https://godbolt.org/z/4oxvYajf6 Fixed the parser and updated the test expectations accordingly. For example, before this diff, the following string: ``` "foo\ bar" ``` was parsed as `"foo\nbar"`. After this diff, it is parsed as `"foobar"`. Reviewed By: iahs Differential Revision: D102091442 fbshipit-source-id: 2298dd3db594af7e47dc8dd014c462ff784fbb34
Summary: GitHub commits: facebook/fb303@d2350f3 facebook/fbthrift@226141b facebook@a56211c facebook/hermes@4fcedcc facebook/meta-haptics-sdk@d7f98b1 facebook/mvfst@e724e14 facebook/proxygen@1862436 facebook/pyrefly@560fdbf facebook/wangle@501a9d7 facebookexperimental/edencommon@02cf9b5 facebookexperimental/rust-shed@133069e https://github.com/facebookincubator/MarketingBrain/commit/597bed59a39c75c478d0b692100896e95a64178c facebookincubator/fizz@5a9a07e Reviewed By: pranavcivi fbshipit-source-id: ce7e9114ab5f82933e5935d0cf3528202bb22268
Summary:
Re-attempt of D102214203, which was reverted in D102405193 because of build breakage.
Removing the experimental symbolizer entirely. All references in the repo are cleaned up.
Fixes vs original D102214203:
- Fixed broken `<folly //coro/X.h>` includes (the `//` was being treated as a C++ comment) in:
fbcode/urv/retriever/{Acl,AmpGroup,Fbpkg,IResource,IUniversalSearchAdapter,Reservation,RoutingConfig,UserJob}RelationshipProvider.h
and the corresponding test/*.cpp files.
- Fixed broken `//folly//coro:X` BUCK target paths (extra slash) in:
fbcode/urv/retriever/BUCK, fbcode/treadmill/facebook/services/mobiclaw_bash_sandbox/BUCK
- Removed `experimental/symbolizer/*.h` raw_headers entries from xplat/folly/BUCK
(and mirrored fbcode/folly/BUCK) — these were the root cause of the
citadel-orchestrator-xplat NON_BYPASSABLE failure that triggered the revert
("File not found: fbsource//xplat/folly/experimental/symbolizer/Dwarf.h. Included
in xplat/folly/BUCK but does not exist").
#forcedanglingcheck
Reviewed By: rexzhang123
Differential Revision: D102420094
fbshipit-source-id: 88d16f84e7cc2fd91dbe3fa3785f38d67055c106
…(7/8) - leftovers Summary: Migrate coro references in remaining fbcode services (n-z), xplat/, fbobjc/, fbandroid/, and third-party/. Reviewed By: Magoja Differential Revision: D99856552 fbshipit-source-id: 101c31802503616805288e6be8d4453f09c3d0e2
…y/experimental (re-attempt) Summary: Removing the symbolizer shims, now unused. #forcedanglingcheck Reviewed By: rexzhang123 Differential Revision: D102638436 fbshipit-source-id: 7ab88987efd56790212d79af47fbd419494cf351
Summary: Convert the last fbcode_target in xplat/folly/channels/test/BUCK to use fb_dirsync_cpp_unittest. ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: stddevx landed-with-radar-review Differential Revision: D102877436 fbshipit-source-id: 60dd0c04ffe140051f655adcc02d5c0a2f5c29ad
Summary: Wearables enabled `-march=armv8-a` for colada (32-bit ARM running ARMv8 ISA), which sets `__ARM_FEATURE_CRC32` and lights up the `FOLLY_ARM_FEATURE_CRC32` branch in folly. The nvidia external hw impl was gated on `__aarch64__` only, so `crc32_hw` / `crc32c_hw` went undefined and `oxide_wrist_armv7_debug` failed to link. Added an `__arm__` codepath that uses `__crc32{c,}w` for 4-byte chunks - AArch32 has no 64-bit `__crc32{c,}d` since there are no 64-bit GPRs. Also fixed the `gf_multiply_crc32{c,}_hw` stubs in `Crc32CombineDetail.cpp` - they returned 0, silently corrupting `crc32_combine` whenever `crc32_hw_supported()` was true but the AES+SHA2+NEON combine path wasn't available. They now fall back to the SW multiply so combine stays correct on AArch32+CRC32.
Reviewed By: boguscoder
Differential Revision: D102691132
fbshipit-source-id: bb5c38bf8d813784fd94090133740de32845d0c8
Summary: Merge the non_fbcode_target + fbcode_target pair for :gflags into a single fb_dirsync_cpp_library. Reviewed By: 8Keep Differential Revision: D102730034 fbshipit-source-id: 251abbc1c698746c73659a42e4c71539826a8411
Summary: 1. Add FOLLY_MUSTTAIL attribute macro to folly/CppAttributes.h 2. Use FOLLY_MUSTTAIL in `Json5ProtocolReader::readFieldBegin` to guarantee tail-call optimization on the recursive call that skips null field values, preventing stack growth on deeply nested JSON with many null fields. Also scope the parsed variable block to ensure local variables are destroyed before the tail call, as required by musttail semantics. Reviewed By: iahs Differential Revision: D102214102 fbshipit-source-id: d536de39572453e8a2add482b61d498fc8940dd5
Summary: delete `test` target in folly/futures/test as it doesn't have any usage in the codebase. ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: stddevx landed-with-radar-review Differential Revision: D102875927 fbshipit-source-id: 11b3790a9d12508d8de6006778f52f8b5693c0f7
Summary: migrating to dirsync macros to enable dirsync unification added in logic that dl_open adds for fbcode in tools/build_defs/fbcode_macros/build_defs/cpp_binary.bzl to xplat Reviewed By: rexzhang123 Differential Revision: D98843231 fbshipit-source-id: cf6c48abff22edf951cc82e5691926fa3a5716ed
Summary: We've seen some races with the getenv() here due to other software calling setenv() in parallel. This doesn't fundamentally fix the race, but makes it far less likely. This is a beneficial change anyways because the value isn't really something we expect to change throughout the lifetime of a process Reviewed By: skrueger Differential Revision: D102727113 fbshipit-source-id: 1e735810536fab84a11f153102c9fd339e4726bb
Summary: Moving to a real constraint(), and move to the root buck file, not a /constraints subdir. Reviewed By: capickett Differential Revision: D98979084 fbshipit-source-id: f8e752d615dddc47ac71c0c68a69b86571e04f0a
Summary: Convert the last fbcode_target in xplat/folly/container/detail/test/BUCK to fb_dirsync_cpp_unittest. ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: stddevx Differential Revision: D103042058 fbshipit-source-id: b255ff5001e5ba881c18f1934ac5ef32763da863
Summary: Mirrors `Observer::with()` (D105368030) across the rest of the observer family so all consumer-facing observer classes have parity. Each `with(F&&)` invokes the callable with a `const T&` while holding the snapshot alive for the call duration; the return type is decayed to prevent accidental reference-into-snapshot binding, and noexcept propagates from the callable. Added to: - ReadMostlyTLObserver - TLObserver - HazptrObserver - CoreCachedObserver Skipped: AtomicObserver / ReadMostlyAtomicObserver return T by value (no snapshot, no read-after-free concern). Snapshot types are already held views, not observers. SimpleObservable exposes Observer<T> via getObserver(). Reviewed By: Orvid, garciaen Differential Revision: D105744619 fbshipit-source-id: adba74af2f074aafde76a85e2632b43e55ded69c
Summary: Our GHA workflows did not previously use sccache, so they had a complex per-dep cache pyramid. Now they do use sccache. sccache works on a per-file level so it can accelerate builds even when a dependency has changed. Now that we have this new caching mechanism we can retire the cache pyramid for a significant reduction in workflow complexity. Trying that here. Flip `--use-build-cache` to off by default. The pyramid is now opt-in via `--use-build-cache`; sccache remains on by default for all non-Windows platforms (it was already the default — this change makes the pyramid the non-default). Golden test fixtures are regenerated to match the new output shape. Reviewed By: bigfootjon Differential Revision: D105903053 fbshipit-source-id: 8eb0fa3afa0de8975752710bb695619d2453d2c4
…rate Laser ThriftDeserializer
Summary:
Add two new `FloatFormat` variants — `SHORTEST_SINGLE` and `SHORTEST_SINGLE_TRAILING_DOT_ZERO` — that cast the value to `float` before formatting. This finds the shortest decimal that round-trips to the same IEEE-754 single-precision value, which is appropriate for values originally stored as 32-bit Thrift `float` fields; the extra digits in their `double` representation are precision noise (e.g. `4.099999904632568` → `"4.1"`).
Implemented via `fmt::format("{}", static_cast<float>(dval))` and `fmt::format("{:#}", static_cast<float>(dval))` respectively, mirroring the existing `SHORTEST`/`SHORTEST_TRAILING_DOT_ZERO` pair. Changes are mirrored to `xplat/folly/json/`.
Migrates `laser/utils/ThriftDeserializer.cpp` from the deprecated `dtoa_mode = DtoaMode::SHORTEST_SINGLE` + `dtoa_flags` pair to `float_format = FloatFormat::SHORTEST_SINGLE_TRAILING_DOT_ZERO`, unblocking the previous migration attempt (D104716185) that had to be reverted (D105365672) because `SHORTEST_TRAILING_DOT_ZERO` uses double precision and changed the output. See T270785993.
Differential Revision: D105993958
fbshipit-source-id: 12fd9568af73e0cdb81d7170d298278876aa19c7
Summary: D104716185 replaced `dtoa_mode = SHORTEST_SINGLE` + `dtoa_flags` with `float_format = FloatFormat::SHORTEST_TRAILING_DOT_ZERO` in Laser's `ThriftDeserializer`. The diff noted `SHORTEST_SINGLE` was "effectively a no-op," but it actually mattered: it formatted float values widened to double with single-precision shortest representation (e.g., `4.1` instead of `4.099999904632568`). This adds two new `FloatFormat` variants that cast to `float` before formatting with fmt's Dragonbox, so the shortest round-trip target is 32-bit IEEE-754: - `SHORTEST_SINGLE` — like `SHORTEST` but single-precision - `SHORTEST_SINGLE_TRAILING_DOT_ZERO` — like `SHORTEST_TRAILING_DOT_ZERO` but single-precision Laser's `ThriftDeserializer` is updated to use `SHORTEST_SINGLE_TRAILING_DOT_ZERO`, restoring the original serialization behavior for float fields. Differential Revision: D105375837 fbshipit-source-id: 986114bd7c6df3645d91d123933ccf81a7e9bb59
…ERO}` to folly JSON Differential Revision: D105375837 Original commit changeset: 986114bd7c6d Original Phabricator Diff: D105375837 fbshipit-source-id: 6cb83bd42606f2b18eebd5bb94c7da172c213a4e
Differential Revision: D105927635 fbshipit-source-id: 4aa477e6fcb2e0d42543aa0d46d9957a0a7e32c6
…ization/HazptrHolder Differential Revision: D105927795 fbshipit-source-id: 8d74b1d4af59fdfb860d151745ea277279cf32cf
Differential Revision: D105928594 fbshipit-source-id: af5a0c247e6d7f4046971a0f91f9d46cdad6e60f
…single recursive step Summary: Replace the per-dep `Build <dep>` / `Cache <dep>` step pyramid in generated GitHub Actions workflows with a single `Build <project> --recursive` step. With sccache enabled by default (since 6c880b17) we do not need per-dep builds. Changes: - `workflow_generator.py`: remove the per-dep deps loop, `has_same_repo_dep`, `no_deps_arg`, `free_up_disk_arg`, and `--use-build-cache` CLI flag; `final_build_cmd` now always passes `--recursive --src-dir=.` - `templates/workflow.yml.j2`: remove `cache_restore`/`cache_save` macros and the `for dep in deps` loop - `test/workflow_generator_test.py`: drop `use_build_cache` from base args - Golden fixtures and all OSS project workflows regenerated via `update-all-github-actions.sh` Reviewed By: bigfootjon Differential Revision: D106028158 fbshipit-source-id: e1d69616fe85553b0d00b6822988dac58bec9c3c
Summary: D104716185 replaced `dtoa_mode = SHORTEST_SINGLE` + `dtoa_flags` with `float_format = FloatFormat::SHORTEST_TRAILING_DOT_ZERO` in Laser's `ThriftDeserializer`. The diff noted `SHORTEST_SINGLE` was "effectively a no-op," but it actually mattered: it formatted float values widened to double with single-precision shortest representation (e.g., `4.1` instead of `4.099999904632568`). This adds two new `FloatFormat` variants that cast to `float` before formatting with fmt's Dragonbox, so the shortest round-trip target is 32-bit IEEE-754: - `SHORTEST_SINGLE` — like `SHORTEST` but single-precision - `SHORTEST_SINGLE_TRAILING_DOT_ZERO` — like `SHORTEST_TRAILING_DOT_ZERO` but single-precision Laser's `ThriftDeserializer` is updated to use `SHORTEST_SINGLE_TRAILING_DOT_ZERO`, restoring the original serialization behavior for float fields. ___ Reviewed By: BernardZhao Differential Revision: D106050157 fbshipit-source-id: 8de94ddd5b6247ac74a300f0b935a68b38dd688c
Summary: The `build` subcommand already builds all transitive deps unconditionally (`manifests_in_dependency_order()` always returns the full dep graph). The `--recursive` flag added to `final_build_cmd` in D106028158 is not a recognized argument for `build`, so argparse exits non-zero and every GHA job fails before building anything. Fix: remove `--recursive` from the generated build step in `workflow_generator.py`. Regenerated all affected workflow files via `update-all-github-actions.sh` and updated test fixtures with `UPDATE_FIXTURES=1 buck run`. The `--recursive` flag remains correct on `install-system-deps` and `query-paths` steps, where it is a defined and meaningful argument. Supersedes D106119149. Reviewed By: bigfootjon Differential Revision: D106122539 fbshipit-source-id: f10dc25bee75b64171844d94cd35eec0f37e8445
Summary: X-link: facebook/proxygen#619 Bump gperf from 3.1 to 3.3 in the fbcode_builder manifest and add the corresponding LFS pointer for the new tarball. Reviewed By: jbeshay, kvtsoy Differential Revision: D106373850 fbshipit-source-id: e57201a74ea06c12852a50efb5b5b858d712777c
Summary: Got a complaint from the automatic checkup tool about this, just add the text Reviewed By: r-barnes Differential Revision: D105719397 fbshipit-source-id: 0b6158b1668e0bb9089fe56bfb2b6aa513b0b762
Summary: Convert 18 enable_if_t guards across Poly.h and Poly-inl.h to requires clauses using IsPoly, ModelsInterface, ValueCompatible, and ReferenceCompatible traits. PolyDetail.h partial specialization sites left unchanged (requires not permitted in that position in C++20). ___ Differential Revision: D101660200 fbshipit-source-id: 31d5814fefdeb577705a55d844fd44625878fce6
…tUseImmediately Reviewed By: skrueger Differential Revision: D106268800 fbshipit-source-id: f4b9e0650e6727900ec6b0d87de2d8eb8809bb47
Summary: We need some aliasing Reviewed By: 8Keep Differential Revision: D102393172 fbshipit-source-id: 7369ff70f5b1078c138d45dc0b7fa51aa50d3c83
Summary: implement rust dirsync rule Reviewed By: 8Keep Differential Revision: D102393204 fbshipit-source-id: e8c11e8746d9ec47431f0eeb946dfdb64c30c1db
Summary: As explained in the `static_assert` comment, the second `contains` templace in CollectionUtil will only be instantiated by collection types that satisfy HasFind or HasContains. Otherwise, the first contains template definition is instantiated. Reviewed By: kalman5 Differential Revision: D106406225 fbshipit-source-id: 77a3afe1f8cf42e2f01a74ac2bb374be53b75763
…on; add Python json.loads() test
Summary:
`FloatFormat::SHORTEST_TRAILING_DOT_ZERO` (and its single-precision sibling) dispatched to `fmt::format("{:#}", x)`. The `{:#}` alternate form guarantees a decimal point is present but does not guarantee a digit after it when the shortest representation has an integer mantissa in scientific notation: `3e-6` formats as `"3.e-06"`, not `"3.0e-06"`. RFC 8259 §6 requires at least one digit after the decimal point, so `"3.e-06"` is invalid JSON and Python's `json.loads()` rejects it.
Root cause: the original double-conversion library kept values down to `3e-6` in decimal notation (threshold `decimal_in_shortest_low = -6`), so `EMIT_TRAILING_DECIMAL_POINT | EMIT_TRAILING_ZERO_AFTER_POINT` never needed to fire in the scientific-notation path — those flags were silently ignored there. The `{:#}` equivalent claim in the enum comment was always incorrect; fmt uses a different decimal/scientific threshold and exposes the gap.
Fix: replace the `{:#}` dispatch with a new `appendShortestTrailingDotZero<Float>()` helper that formats via `fmt::format_to_n("{}", fval)` into a 32-byte stack buffer, then emits the mantissa, `".0"`, and exponent as three separate `out_.append()` calls — no `memmove` on the output string, no heap allocation.
Also fixes a latent bug in `SHORTEST_SINGLE` and `SHORTEST_SINGLE_TRAILING_DOT_ZERO`: the inf/NaN guard in `appendDouble` checked only the original `double`, so a finite `double` that overflows `float` (e.g. `1e100 → +inf`) bypassed the guard and produced `"inf"` via fmt instead of `"Infinity"`. Both single-precision cases now check inf/NaN on the float-cast value before formatting.
New test: `fbcode/folly/json/test/tests/test_float_format_python_json.py` is a nanobind-based Python test that serializes a range of tricky doubles (integer-mantissa scientific notation, integer-valued, ordinary fractional) through every `FloatFormat` mode and validates each result with Python's `json.loads()`. It also spot-checks exact output strings for the `SHORTEST_TRAILING_DOT_ZERO` scientific-notation cases. This test was written before the fix and confirmed the bug; it now passes cleanly.
Reviewed By: zoltanpusztai
Differential Revision: D106405647
fbshipit-source-id: 31d948121eff6a78a212bdd5a919326a7127d822
Summary: Convert 9 function templates in CheckedMath.h from std::enable_if_t constraints to requires clauses. Constraints include std::is_integral_v<T>, std::is_unsigned<T>::value, std::is_pointer<T>::value, and combinations thereof (previously split across return-type SFINAE and default template parameters). Reviewed By: ilvokhin Differential Revision: D101656942 fbshipit-source-id: 32b24c10fcb5aff8be246eb148404df48959a54b
Summary: Configure fbcode//folly and xplat/folly to use the new constraint-based redirect mechanism. Both PACKAGE files are identical (dirsynced) and configure the same mappings. When a platform sets ovr_config//folly/constraints:fbcode, xplat/folly targets will redirect to fbcode//folly. When ovr_config//folly/constraints:xplat is set, fbcode//folly targets redirect to xplat/folly. DEFAULT behavior is no redirection, maintaining backwards compatibility. Reviewed By: IanChilds, rexzhang123, mzlee Differential Revision: D92558031 fbshipit-source-id: d8a0519caf6a4cf0cf8ac8109d64c0b672d8ab43
Summary:
Vendors a minimal openr slice into `public_tld/openr/` so the OSS build can drop the `openr` getdeps dependency entirely. Carries forward magic_enum, fmt, and other OSS build fixes. Does NOT include `#ifndef IS_OSS` gates for hiding `NetlinkWrapper` — that is handled architecturally by D105648380 (augmentation pattern moving `NetlinkWrapper` into `BgpServiceBB`).
**Vendored openr files** (`public_tld/openr/`, see `PROVENANCE.md` for full notes and removal trigger):
- `if/Network.thrift` — verbatim copy
- `if/Platform.thrift` — copy with two adaptations: removed `include "fb303/thrift/fb303_core.thrift"` and the `extends fb303_core.BaseService` clause on `FibService`. BGP++ uses `FibService` only as a client and never calls `BaseService` methods.
- `common/NetworkUtil.{h,cpp}` — copy with adaptations: removed unused `Constants.h`, `OpenrCtrl_types.h`, `Types_types.h` includes; replaced `throw thrift::OpenrError(...)` with `throw std::runtime_error(...)`.
- `monitor/SystemMetrics.{h,cpp}` — pre-existing vendor (untouched here).
**`public_tld/CMakeLists.txt` changes:**
- Dropped `find_path(OPENR_INCLUDE_DIR ...)` and the four `find_library(OPENR_*)` calls.
- Added `add_fbthrift_cpp_library` for vendored `Network.thrift` and `Platform.thrift` (mirroring the D104704212 fb303 pattern).
- Added `add_library(openr_networkutil openr/common/NetworkUtil.cpp)`.
- Updated `set(OPENR_LIBS ...)` to point to the new local targets — all existing `${OPENR_LIBS}` references in `bgp_common`, `bgp_nexthop`, `bgp_rib`, `bgp_adjrib`, `bgp_peer`, `bgp_service` continue to work.
- Removed `NetlinkWrapper.cpp` from `add_library(bgp_nexthop)` source list (it pulls unvendored `openr/messaging` + `openr/nl`).
- Updated `install(DIRECTORY ... PATTERN "*.h")` to exclude `facebook`, `RibBB.h`, and `NetlinkWrapper.h` (the header pulls unvendored openr symbols).
**Other OSS build fixes:**
- `cpp/lib/fibers/FiberBgpPeerManager.cpp`: wrap fmt enum-format sites with `magic_enum::enum_name()`.
- `cpp/policy/PolicyMatch.cpp`: add `<fmt/format.h>` and `<fmt/ranges.h>`.
- `cpp/policy/PolicyAction.cpp`, `PolicyTerm.cpp`: wrap fmt enum-format sites with `magic_enum::enum_name()`.
- `cpp/policy/base/PolicyMatchBase.h`: drop `noexcept` from virtual `Match` (function throws `std::bad_function_call`; newer Clang flags as `-Werror=exceptions`).
- `public_tld/configerator/structs/neteng/fboss/thrift/common.thrift`: local mirror needed because FBOSS does not install its generated `common_types.h` (same fb303 pattern as D104704212).
- `public_tld/configerator/structs/neteng/fboss/bgp/bgp_config.thrift`: add `enhanced_route_refresh` and `route_refresh` fields with the same field IDs as the internal copy for wire compatibility.
- `manifests/bgp`: keeps `magic_enum`, drops `openr` (no longer needed since the IDL and `NetworkUtil` are vendored).
- `cpp/policy/BUCK`, `cpp/lib/BUCK`: include updates surfaced by autodeps.
**Removal trigger:** The vendored `openr/` slice can be deleted once the Phase 2 refactor of `NexthopInfoBase`/`NexthopStatus`/`Utils` to BGP++-private thrift types lands — at which point the entire `public_tld/openr/` tree (except `monitor/`) goes away and the openr getdeps dep is removed permanently.
Reviewed By: xiangxu1121
Differential Revision: D106128986
fbshipit-source-id: 0cdef66679e18d89e555dfd311daeafe8e67930f
Differential Revision: D92558031 Original commit changeset: d8a0519caf6a Original Phabricator Diff: D92558031 fbshipit-source-id: a5b540bc8c6448d9d0dd399a5a9c1312c6637ae6
Summary: Add tests that validate lld's reverse relaxation correctly expands .gcc_except_table type table entries from sdata4 to sdata8 when PC-relative relocations overflow 32 bits. Two test variants: - Non-PIC (default): TType encoding 0x1b -> 0x1c (pcrel | sdata4 -> sdata8) - PIC (static_pic): TType encoding 0x9b -> 0x9c (indirect | pcrel | sdata4 -> sdata8) Reviewed By: jpporto Differential Revision: D101901166 fbshipit-source-id: 49af2a19856a0f883f277c1a68722cc54b0cf11d
Summary: Replace `constraint_setting` + 2 `constraint_value` rules with `constraint_with_aliases` — the pattern already used by `packed-relocations` and `relr-relocations` in the same file. The `aliases` dict keeps `:cxx-static-runtime-type` and `:cxx-shared-runtime-type` resolvable so existing platforms and selects still work unchanged. `default = "undefined"` matches the previous unset behavior: unset configs hit `DEFAULT` branches in selects (same as before), and the unified-constraint config-hash rule means unset equals default produces the same hash, no cache invalidation. Same diff flips every non-generated consumer (21 files: VrRuntime, ar/VrDriver, xru_driver, folly exception_tracer, llvm-project, force_dlopen, tracking_clients, visioninterface, ar_connectivity, perception, xr_recording_infra, bolt, voice_ai eval, arfx benchmark, aosp ndk_transition, human_understanding) to the new `:cxx_runtime_type[static]` and `:cxx_runtime_type[shared]` subtarget syntax. The 4 OpenXR APEX BUCKs (amethyst, diamond, core_client) plus the VIC layer BUCK from the parent commit get the same treatment. Two follow-ups remain before the aliases can be dropped: 1. Update `arvr/mode/gen-mode.py` to emit subtarget syntax + regenerate `arvr/tools/build_defs/config/platform/android/generated.bzl`. 2. Drop the `aliases` dict from `constraint_with_aliases` once no consumer references the old names. Reviewed By: vif Differential Revision: D106447749 fbshipit-source-id: 686531a40f3441e9077589df6d30faafcfed8598
… of self move Summary: While debugging stuck threads in smcproxy while waiting for SharedMutex in FanoutSenderProcessor (https://fburl.com/code/dvs4anpr), I noticed this bug(?) in FanoutSender's assignment operator. Reviewed By: SmithAndr Differential Revision: D106327156 fbshipit-source-id: 9f42ad2bb4f6586c0d6093348f4378016cc3e687
Summary: Fix memory-based exec notification on macOS by allocating `ChildErrorInfo` via `mmap(MAP_SHARED | MAP_ANONYMOUS)` on Apple platforms. Since macOS maps `vfork` to `fork`, the child process no longer shares the parent's address space, breaking the stack-allocated error info. The shared memory mapping ensures error info visibility across both processes while preserving the existing behavior on Linux/FreeBSD. --- AI generated Summary & Test Plan from DEV179058944 Reviewed By: skrueger Differential Revision: D101043225 fbshipit-source-id: a4e3e5bf20fae60f2d9e2cd779e93f126a25ca69
Summary: Add support for ZCRX kernel notifications and stats in IoUringZeroCopyBufferPool. The kernel can now notify userspace about zero-copy receive events such as buffer exhaustion (no_buffers) and copy fallbacks. An associated stats structure will be updated and the application read from it. This is useful for monitoring and debugging ZCRX performance in production. In order to reports these stats to the upper layers, add a per Backend stat struct for both ProvidedBufferRing and ZeroCopyBufferPool that can be read from the backend using getStats(). /!\ This depends on an unmerged kernel upstream feature : https://github.com/clementleger/linux/tree/cleger/zcrx_copy_fallback Reviewed By: spikeh Differential Revision: D100147628 fbshipit-source-id: e4f3134b3824ebe15f33b507a5ee0551c07c58c4
Reviewed By: ot Differential Revision: D106579439 fbshipit-source-id: 7a3ab8fbef1d4de8a193f3cef21f67149bec27d7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code that handles a token still in
currentwhen content ends had two independent backward scans:while/pop_backloop that stripped trailing spaces from the processed string value (current).forloop that scannedcontentbackward from EOF to recompute the byte-spanlength, becausecurrentmay have undergone escape substitution and its size no longer matches the raw source bytes.The root cause was that the main scan loop had no record of where in
contentthe last non-whitespace character of the current token sat.Fix: add
token_end_offset(byte index intocontentof the last non-space character), updated in every branch that already updatestoken_end_line/token_end_col— seven sites in total. The EOF path can now computelength = token_end_offset + 1 - token_startin O(1), removing the backward scan ofcontententirely. Thewhile/pop_backtrim ofcurrentis kept (it handles the string value) but tightened to the idiomaticwhile (!x.empty() && cond(x.back()))form.